package b.j.a;

import android.database.Cursor;
import android.widget.Filter;
import android.widget.Filter.FilterResults;
import b.b.h.z;

/* compiled from: CursorFilter */
public class b extends Filter {
    public a a;

    /* compiled from: CursorFilter */
    public interface a {
    }

    public b(a aVar) {
        this.a = aVar;
    }

    public CharSequence convertResultToString(Object obj) {
        return ((z) this.a).c((Cursor) obj);
    }

    /* JADX WARNING: Removed duplicated region for block: B:18:0x0049  */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x0040  */
    public android.widget.Filter.FilterResults performFiltering(java.lang.CharSequence r5) {
        /*
        r4 = this;
        r0 = r4.a;
        r0 = (b.b.h.z) r0;
        java.util.Objects.requireNonNull(r0);
        if (r5 != 0) goto L_0x000c;
    L_0x0009:
        r5 = "";
        goto L_0x0010;
    L_0x000c:
        r5 = r5.toString();
    L_0x0010:
        r1 = r0.l;
        r1 = r1.getVisibility();
        r2 = 0;
        if (r1 != 0) goto L_0x0038;
    L_0x0019:
        r1 = r0.l;
        r1 = r1.getWindowVisibility();
        if (r1 == 0) goto L_0x0022;
    L_0x0021:
        goto L_0x0038;
    L_0x0022:
        r1 = r0.m;	 Catch:{ RuntimeException -> 0x0030 }
        r3 = 50;
        r5 = r0.g(r1, r5, r3);	 Catch:{ RuntimeException -> 0x0030 }
        if (r5 == 0) goto L_0x0038;
    L_0x002c:
        r5.getCount();	 Catch:{ RuntimeException -> 0x0030 }
        goto L_0x0039;
    L_0x0030:
        r5 = move-exception;
        r0 = "SuggestionsAdapter";
        r1 = "Search suggestions query threw an exception.";
        android.util.Log.w(r0, r1, r5);
    L_0x0038:
        r5 = r2;
    L_0x0039:
        r0 = new android.widget.Filter$FilterResults;
        r0.<init>();
        if (r5 == 0) goto L_0x0049;
    L_0x0040:
        r1 = r5.getCount();
        r0.count = r1;
        r0.values = r5;
        goto L_0x004e;
    L_0x0049:
        r5 = 0;
        r0.count = r5;
        r0.values = r2;
    L_0x004e:
        return r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.j.a.b.performFiltering(java.lang.CharSequence):android.widget.Filter$FilterResults");
    }

    public void publishResults(CharSequence charSequence, FilterResults filterResults) {
        a aVar = this.a;
        Cursor cursor = ((a) aVar).c;
        Cursor cursor2 = filterResults.values;
        if (cursor2 != null && cursor2 != cursor) {
            ((z) aVar).b(cursor2);
        }
    }
}
